#
# ParameterWeaver: a code generator to handle command line parameters
# and configuration files for C/C++/Fortran/R/Octave
# Copyright (C) 2013 Geert Jan Bex <geertjan.bex@uhasselt.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
CC = gcc
CPPFLAGS =
CFLAGS = -O2
LDFLAGS =
LIBS = -lm

OBJS = cl_params.o cl_params_aux.o
APPL = cl_params config_params

all: $(APPL)

cl_params: cl_params.h $(OBJS) main.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(OBJS) main.o $(LDFLAGS) $(LIBS)

config_params: cl_params.h $(OBJS) main_config.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(OBJS) main_config.o $(LDFLAGS) $(LIBS)

cl_params.o: cl_params.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
    
cl_params_aux.o: cl_params_aux.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
    
cl_params.h: param_defs.txt
	weave -l C -d $<

clean:
	rm -f cl_params.[ch] cl_params_aux.[ch] *.o $(APPL) core output.txt

